home *** CD-ROM | disk | FTP | other *** search
- unit CPanelU;
-
- interface
-
- uses
- WinProcs, WinTypes, Messages, SysUtils, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls;
-
- type
- TForm1 = class(TForm)
- ListBox1: TListBox;
- procedure FormCreate(Sender: TObject);
- procedure ListBoxDblClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- uses
- ShellAPI;
-
- procedure TForm1.FormCreate(Sender: TObject);
- {$ifdef Windows}
- const
- MAX_PATH = 255;
- {$endif}
- var
- SysDirC: array[0..MAX_PATH] of Char;
- SysDir: String;
- SearchRec: TSearchRec;
- begin
- GetSystemDirectory(SysDirC, SizeOf(SysDirC));
- SysDir := StrPas(SysDirC);
- if FindFirst(SysDir + '\*.cpl', faAnyFile, SearchRec) = 0 then
- try
- repeat
- ListBox1.Items.Add(UpperCase(SearchRec.Name));
- until FindNext(SearchRec) <> 0;
- finally
- FindClose(SearchRec);
- end;
- end;
-
- procedure TForm1.ListBoxDblClick(Sender: TObject);
- var
- Param: String;
- ParamC: array[0..255] of Char;
- begin
- Param := 'shell32.dll,Control_RunDLL ' + ListBox1.Items[ListBox1.ItemIndex];
- Caption := Param;
- StrPCopy(ParamC, Param);
- ShellExecute(Handle, nil, 'RunDll32.exe', ParamC, nil, sw_ShowNormal)
- end;
-
- end.
-